import { createSlice } from "@reduxjs/toolkit";
const initialState = {
    data: [
        {
            id: 1,
            name: '图文',
            cnmd: '/src/assets/image/home_page/side_menu/changtu.png',

        },
        {
            id: 2,
            name: '单页',
            cnmd: '/src/assets/image/home_page/side_menu/yingxiao.png'
        },
        {
            id: 3,
            name: '装饰',
            cnmd: '/src/assets/image/home_page/side_menu/yiqixiu.png'
        },
        {
            id: 4,
            name: '艺术字',
            wcnmd: '点击可以编辑'
        },
    ],
    list: [],
    cnm:'',
    cnmd:'',
    cnmb:'',
}
const root = createSlice({
    name: 'conter',
    initialState,
    reducers: {
        addlist: (state: any, action: any) => {
            console.log(action, '==================================》action')
            state.list.push(action.payload)
        },
        addlists: (state: any, action: any) => {
            console.log(action, '==================================》actions')
            state.cnm=action.payload
        },
        addlistes: (state: any, action: any) => {
            console.log(action, '==================================》actions')
            state.cnmd=action.payload
        },
         addlisteos: (state: any, action: any) => {
            console.log(action, '==================================》actions')
            state.cnmb=action.payload
        }
    },
})
export const { addlisteos } = root.actions;
export const { addlistes } = root.actions;
export const { addlists } = root.actions;
export const { addlist } = root.actions;
export default root.reducer;